Document

Used Car Price Predictor



{{ prediction_text }}

Enter Car Details:

Age of the car(In years)

Present Showroom Price(In lakhs)


Kilometers Driven

Owner Type (0/1/3)


Fuel type


Seller Type


Transmission type





from flask import Flask,render_template, request, jsonify import pickle import numpy as np import sklearn app = Flask(__name__) # open and load the pickle file provided in read mode. model = pickle.load(open('model.pkl','rb')) @app.route('/', methods = ['GET']) def Home(): return render_template('index.html') @app.route('/predict', methods = ['POST']) def predict(): if request.method == 'POST': Present_Price = float(request.form['Present_Price']) Kms_Driven = int(request.form['Kms_Driven']) Owner = int(request.form['Owner']) Fuel_Type = int(request.form['Fuel_Type']) Age_of_the_car = int(request.form['Age_of_the_car']) Seller_Type = int(request.form['Seller_Type']) Transmission = int(request.form['Transmission']) # Predict function to read the values from the UI and predict the price value. prediction = model.predict([[Present_Price,Kms_Driven,Owner,Fuel_Type,Age_of_the_car,Seller_Type,Transmission]]) output = round(prediction[0],2) return render_template('index.html', prediction_text="You can sell your car at {} lakhs".format(output)) if __name__ = "__main__": app.run(debug=True)